﻿using System;
using Orid.Management.Statistics.Tools.Decomposition.Model;

namespace Orid.Management.Statistics.Tools.Decomposition.Data
{
    class OrderOnline : Order
    {

        public override ModelOrder GetOrderItem(Guid OrderId)
        {

            try
            {
                ModelOrder model;
                if (OrderId == null)
                {
                    return null;
                }
                string connectString = Config.Setting.SettingInstance.DBAddress_Online;
                //[OrderDatas]
                string tableOrderName = "[FutureManagement_Manage].[FutureMa].[OrderDatas]";

                string tableMatterName = "[FutureManagement_Masters].[FutureMa].[Matters] ";

                model = GetOrderItem(OrderId, connectString, tableOrderName, tableMatterName);


                StoreServersOnline storeServers = new StoreServersOnline();
                model.DataDBAddress = storeServers.GetDBAddress(model.DataDBAddress);
                model.JobDBAddress = storeServers.GetDBAddress(model.JobDBAddress);

                OrderFlowProgress orderFlowProgress = new OrderFlowProgressOnline();
                
                model.ListModelProgress =  orderFlowProgress.GetOrderFlowProgress(model.OrderID);

                             

                return model;

            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                throw (new Exception(ex.Message));
            }

        }

    }
}
